Imports System.Data.OracleClient


Public Class clsGnrtConstMods

  Private clsobjFileGnrt As clsGnrtFile

  Private mCmdData As OracleCommand
  Private mDrData As OracleDataReader

  Private mFileStr As String = ""
  Public mStrConstantClassName As String = ""






  Public Sub CreateConstantsFile()

    Dim lStrQueryStr As String = ""
    Dim lStrClassName As String = ""

    clsobjFileGnrt = New clsGnrtFile

    mStrConstantClassName = "BCAST_CMMN"
    lStrClassName = fnClassName(mStrConstantClassName)

    lStrQueryStr = "select distinct CNST_CNST_NAME,CNST_CNST_VALU,CNST_DATA_TYPE from"
    lStrQueryStr = lStrQueryStr & " TRDX_PP_CONSTANT order by CNST_CNST_NAME"

    mCmdData = New OracleCommand(lStrQueryStr, con)
    mDrData = mCmdData.ExecuteReader



    mFileStr = mFileStr & "Public Module mod" & fnClassName(mStrConstantClassName) & vbCrLf & vbCrLf

    While mDrData.Read

      mFileStr = mFileStr & gCONST_SPACES2
      mFileStr = mFileStr & "Public Const " & mDrData("CNST_CNST_NAME") & " As "
      mFileStr = mFileStr & mDrData("CNST_DATA_TYPE") & " = "
      If mDrData("CNST_DATA_TYPE") = "String" Then
        mFileStr = mFileStr & Chr(34) & mDrData("CNST_CNST_VALU") & Chr(34) & vbCrLf
      Else
        mFileStr = mFileStr & mDrData("CNST_CNST_VALU") & vbCrLf
      End If
    End While

    mFileStr = mFileStr & vbCrLf & "End Module"

    clsobjFileGnrt.mprGnrtVbFiles(mFileStr, "mod" & lStrClassName, "Structure Constants")

  End Sub




  Private Function fnClassName(ByVal lCatagoryName As String) As String

    Select Case (lCatagoryName)
      ''To be changed later
      Case ("GLBL_DEFS")
        Return "CommonConstants"

        'To be changed later

      Case ("EXEC_TYPE_FIX")
        Return "FIX"
      Case ("BCAST_CMMN")
        Return "CommonConstants"
      Case ("FIXX_CODE")
        Return "FIX"
      Case ("GLBL_VRBL")
        Return "FIX"
      Case ("HARD_CODE")
        Return "FIX"
      Case ("INTL_MESG")
        Return "FIX"
      Case ("ISMT_MSTR")
        Return "FIX"
      Case ("LOGG_ONXX")
        Return "FIX"
      Case ("ORDR_STAT")
        Return "FIX"
      Case ("RMSX_CNST")
        Return "FIX"
      Case ("RPRT_CNST")
        Return "FIX"
      Case ("SURV_CNST")
        Return "FIX"
      Case ("TRAN_CODE")
        Return "FIX"
      Case Else
        Return ""
    End Select
  End Function


End Class
